home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / binutils.7 / binutils / binutils-2.7 / gas / testsuite / gasp / macro.out < prev    next >
Encoding:
Text File  |  1996-07-04  |  5.1 KB  |  371 lines

  1. !    .MACRO    SUM FROM=0, TO=9
  2. !    ; \FROM \TO
  3. !    MOV    R\FROM,R10
  4. !COUNT    .ASSIGNA    \FROM+1
  5. !    .AWHILE    \&COUNT LE \TO
  6. !    MOV    R\&COUNT,R10
  7. !COUNT    .ASSIGNA    \&COUNT+1
  8. !    .AENDW
  9. !    .ENDM
  10. !
  11.  
  12. !    SUM 0,5
  13. !    ; 0 5
  14.     ; 0 5
  15. !    MOV    R0,R10
  16.     MOV    R0,R10
  17. !COUNT    .ASSIGNA    0+1
  18. !    .AWHILE    \&COUNT LE 5
  19. !    MOV    R\&COUNT,R10
  20. !COUNT    .ASSIGNA    \&COUNT+1
  21. !    .AENDW
  22. !    MOV    R\&COUNT,R10
  23.     MOV    R1,R10
  24. !COUNT    .ASSIGNA    \&COUNT+1
  25. !    .AWHILE    \&COUNT LE 5
  26. !    MOV    R\&COUNT,R10
  27. !COUNT    .ASSIGNA    \&COUNT+1
  28. !    .AENDW
  29. !    MOV    R\&COUNT,R10
  30.     MOV    R2,R10
  31. !COUNT    .ASSIGNA    \&COUNT+1
  32. !    .AWHILE    \&COUNT LE 5
  33. !    MOV    R\&COUNT,R10
  34. !COUNT    .ASSIGNA    \&COUNT+1
  35. !    .AENDW
  36. !    MOV    R\&COUNT,R10
  37.     MOV    R3,R10
  38. !COUNT    .ASSIGNA    \&COUNT+1
  39. !    .AWHILE    \&COUNT LE 5
  40. !    MOV    R\&COUNT,R10
  41. !COUNT    .ASSIGNA    \&COUNT+1
  42. !    .AENDW
  43. !    MOV    R\&COUNT,R10
  44.     MOV    R4,R10
  45. !COUNT    .ASSIGNA    \&COUNT+1
  46. !    .AWHILE    \&COUNT LE 5
  47. !    MOV    R\&COUNT,R10
  48. !COUNT    .ASSIGNA    \&COUNT+1
  49. !    .AENDW
  50. !    MOV    R\&COUNT,R10
  51.     MOV    R5,R10
  52. !COUNT    .ASSIGNA    \&COUNT+1
  53. !    .AWHILE    \&COUNT LE 5
  54. !    MOV    R\&COUNT,R10
  55. !COUNT    .ASSIGNA    \&COUNT+1
  56. !    .AENDW
  57. !    SUM     TO=5
  58. !    ; 0 5
  59.     ; 0 5
  60. !    MOV    R0,R10
  61.     MOV    R0,R10
  62. !COUNT    .ASSIGNA    0+1
  63. !    .AWHILE    \&COUNT LE 5
  64. !    MOV    R\&COUNT,R10
  65. !COUNT    .ASSIGNA    \&COUNT+1
  66. !    .AENDW
  67. !    MOV    R\&COUNT,R10
  68.     MOV    R1,R10
  69. !COUNT    .ASSIGNA    \&COUNT+1
  70. !    .AWHILE    \&COUNT LE 5
  71. !    MOV    R\&COUNT,R10
  72. !COUNT    .ASSIGNA    \&COUNT+1
  73. !    .AENDW
  74. !    MOV    R\&COUNT,R10
  75.     MOV    R2,R10
  76. !COUNT    .ASSIGNA    \&COUNT+1
  77. !    .AWHILE    \&COUNT LE 5
  78. !    MOV    R\&COUNT,R10
  79. !COUNT    .ASSIGNA    \&COUNT+1
  80. !    .AENDW
  81. !    MOV    R\&COUNT,R10
  82.     MOV    R3,R10
  83. !COUNT    .ASSIGNA    \&COUNT+1
  84. !    .AWHILE    \&COUNT LE 5
  85. !    MOV    R\&COUNT,R10
  86. !COUNT    .ASSIGNA    \&COUNT+1
  87. !    .AENDW
  88. !    MOV    R\&COUNT,R10
  89.     MOV    R4,R10
  90. !COUNT    .ASSIGNA    \&COUNT+1
  91. !    .AWHILE    \&COUNT LE 5
  92. !    MOV    R\&COUNT,R10
  93. !COUNT    .ASSIGNA    \&COUNT+1
  94. !    .AENDW
  95. !    MOV    R\&COUNT,R10
  96.     MOV    R5,R10
  97. !COUNT    .ASSIGNA    \&COUNT+1
  98. !    .AWHILE    \&COUNT LE 5
  99. !    MOV    R\&COUNT,R10
  100. !COUNT    .ASSIGNA    \&COUNT+1
  101. !    .AENDW
  102. !    SUM     FROM=2, TO=5
  103. !    ; 2 5
  104.     ; 2 5
  105. !    MOV    R2,R10
  106.     MOV    R2,R10
  107. !COUNT    .ASSIGNA    2+1
  108. !    .AWHILE    \&COUNT LE 5
  109. !    MOV    R\&COUNT,R10
  110. !COUNT    .ASSIGNA    \&COUNT+1
  111. !    .AENDW
  112. !    MOV    R\&COUNT,R10
  113.     MOV    R3,R10
  114. !COUNT    .ASSIGNA    \&COUNT+1
  115. !    .AWHILE    \&COUNT LE 5
  116. !    MOV    R\&COUNT,R10
  117. !COUNT    .ASSIGNA    \&COUNT+1
  118. !    .AENDW
  119. !    MOV    R\&COUNT,R10
  120.     MOV    R4,R10
  121. !COUNT    .ASSIGNA    \&COUNT+1
  122. !    .AWHILE    \&COUNT LE 5
  123. !    MOV    R\&COUNT,R10
  124. !COUNT    .ASSIGNA    \&COUNT+1
  125. !    .AENDW
  126. !    MOV    R\&COUNT,R10
  127.     MOV    R5,R10
  128. !COUNT    .ASSIGNA    \&COUNT+1
  129. !    .AWHILE    \&COUNT LE 5
  130. !    MOV    R\&COUNT,R10
  131. !COUNT    .ASSIGNA    \&COUNT+1
  132. !    .AENDW
  133. !
  134.  
  135. !
  136.  
  137. !; hi this is a comment
  138.     ; hi this is a comment
  139. !    .MACRO    BACK_SLASH_SET
  140. !    \(MOV    #"\",R0) 
  141. !    .ENDM
  142. !    BACK_SLASH_SET
  143. !    MOV    #"\",R0 
  144.     MOV    #"\",R0 
  145. !    .MACRO    COMM
  146. !    bar    ; this comment will get copied out
  147. !    foo    \; this one will get dropped
  148. !    .ENDM
  149. !    COMM
  150. !    bar    ; this comment will get copied out
  151.     bar    ; this comment will get copied out
  152. !    foo    \; this one will get dropped
  153.     foo    \; this one will get dropped
  154. !    BACK_SLASH_SET
  155. !    MOV    #"\",R0 
  156.     MOV    #"\",R0 
  157. !    .MACRO    PLUS2
  158. !    ADD    #1,R\&V1
  159. !    .SDATA    "\&V'1"
  160. !    .ENDM
  161. !V    .ASSIGNC    "R"
  162. !V1    .ASSIGNA    1
  163. !    PLUS2
  164. !    ADD    #1,R\&V1
  165.     ADD    #1,R1
  166. !    .SDATA    "\&V'1"
  167.     .byte    82,49
  168. !    .MACRO    PLUS1    P,P1
  169. !    ADD    #1,\P1
  170. !    .SDATA    "\P'1"
  171. !    .ENDM
  172. !    PLUS1    R,R1
  173. !    ADD    #1,R1
  174.     ADD    #1,R1
  175. !    .SDATA    "R1"
  176.     .byte    82,49
  177. !
  178.  
  179. !    .MACRO    SUM P1
  180. !    MOV    R0,R10
  181. !    ADD    R1,R10
  182. !    ADD    R2,R10
  183. !    \P1    
  184. !    ADD    R3,R10
  185. !    .ENDM
  186. !
  187.  
  188. !    SUM    .EXITM
  189. !    MOV    R0,R10
  190.     MOV    R0,R10
  191. !    ADD    R1,R10
  192.     ADD    R1,R10
  193. !    ADD    R2,R10
  194.     ADD    R2,R10
  195. !    .EXITM    
  196. !
  197.  
  198. !    .MACRO foo bar=a default=b
  199. !    \bar
  200. !    \default
  201. !    bar
  202. !    default
  203. !    .ENDM
  204. !    foo default=dog bar=cat
  205. !    cat
  206.     cat
  207. !    dog
  208.     dog
  209. !    bar
  210.     bar
  211. !    default
  212.     default
  213. !    foo X Y
  214. !    X
  215.     X
  216. !    Y
  217.     Y
  218. !    bar
  219.     bar
  220. !    default
  221.     default
  222. !    foo
  223. !    a
  224.     a
  225. !    b
  226.     b
  227. !    bar
  228.     bar
  229. !    default
  230.     default
  231. !    foo bar=cat default=dog
  232. !    cat
  233.     cat
  234. !    dog
  235.     dog
  236. !    bar
  237.     bar
  238. !    default
  239.     default
  240. !
  241.  
  242. !
  243.  
  244. !    .MACRO    foo bar
  245. !    HI
  246. !    HI \bar
  247. !    HI
  248. !    .ENDM
  249. !
  250.  
  251. !    foo 1
  252. !    HI
  253.     HI
  254. !    HI 1
  255.     HI 1
  256. !    HI
  257.     HI
  258. !    foo 123
  259. !    HI
  260.     HI
  261. !    HI 123
  262.     HI 123
  263. !    HI
  264.     HI
  265. !    foo 1 2 3 4
  266. !    foo
  267. !    HI
  268.     HI
  269. !    HI 
  270.     HI 
  271. !    HI
  272.     HI
  273. !
  274.  
  275. !    
  276. !    .MACRO    PUSH Rn
  277. !    MOV.L    \Rn,@-r15
  278. !    .ENDM
  279. !    PUSH    R0
  280. !    MOV.L    R0,@-r15
  281.     MOV.L    R0,@-r15
  282. !    PUSH    R1
  283. !    MOV.L    R1,@-r15
  284.     MOV.L    R1,@-r15
  285. !
  286.  
  287. !
  288.  
  289. !    .MACRO    RES_STR STR, Rn
  290. !    MOV.L    #str\@,\Rn
  291. !    BRA    end_str\@
  292. !    NOP
  293. !str\@    .SDATA "\STR"
  294. !    .ALIGN    2
  295. !end_str\@
  296. !    .ENDM
  297. !    
  298. !    RES_STR    "ONE",R0    
  299. !    MOV.L    #str00018,R0
  300.     MOV.L    #str00018,R0
  301. !    BRA    end_str00018
  302.     BRA    end_str00018
  303. !    NOP
  304.     NOP
  305. !str00018    .SDATA "ONE"
  306. str00018:    .byte    79,78,69
  307. !    .ALIGN    2
  308.     .align    2
  309. !end_str00018
  310. end_str00018:
  311. !    RES_STR    "TWO",R1
  312. !    MOV.L    #str00019,R1
  313.     MOV.L    #str00019,R1
  314. !    BRA    end_str00019
  315.     BRA    end_str00019
  316. !    NOP
  317.     NOP
  318. !str00019    .SDATA "TWO"
  319. str00019:    .byte    84,87,79
  320. !    .ALIGN    2
  321.     .align    2
  322. !end_str00019
  323. end_str00019:
  324. !    RES_STR    "THREE",R2
  325. !    MOV.L    #str00020,R2
  326.     MOV.L    #str00020,R2
  327. !    BRA    end_str00020
  328.     BRA    end_str00020
  329. !    NOP
  330.     NOP
  331. !str00020    .SDATA "THREE"
  332. str00020:    .byte    84,72,82,69,69
  333. !    .ALIGN    2
  334.     .align    2
  335. !end_str00020
  336. end_str00020:
  337. !
  338.  
  339. !
  340.  
  341. !
  342.  
  343. !    RES_STR STR=donkey Rn=R1
  344. !    MOV.L    #str00021,R1
  345.     MOV.L    #str00021,R1
  346. !    BRA    end_str00021
  347.     BRA    end_str00021
  348. !    NOP
  349.     NOP
  350. !str00021    .SDATA "donkey"
  351. str00021:    .byte    100,111,110,107,101,121
  352. !    .ALIGN    2
  353.     .align    2
  354. !end_str00021
  355. end_str00021:
  356. !    RES_STR donkey,R1
  357. !    MOV.L    #str00022,R1
  358.     MOV.L    #str00022,R1
  359. !    BRA    end_str00022
  360.     BRA    end_str00022
  361. !    NOP
  362.     NOP
  363. !str00022    .SDATA "donkey"
  364. str00022:    .byte    100,111,110,107,101,121
  365. !    .ALIGN    2
  366.     .align    2
  367. !end_str00022
  368. end_str00022:
  369. !     RES_STR donkey Rn=R1
  370. !    .END
  371.